package com.suping.springbuckssp;

import com.suping.springbuckssp.model.Order;
import com.suping.springbuckssp.model.OrderState;
import com.suping.springbuckssp.service.CoffeeService;
import com.suping.springbuckssp.service.OrderService;
import java.util.Arrays;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@Slf4j
@MapperScan("com.suping.springbuckssp.dao")
public class SpringBucksSpApplication implements ApplicationRunner {
    @Autowired
    private CoffeeService coffeeService;
    @Autowired
    private OrderService orderService;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        Order order= orderService.createOrder("zhangsan");
        coffeeService.deleteById(1L);
        orderService.updateState(order, OrderState.BREWED);
        coffeeService.findAllCoffee();
        coffeeService.findListByPageHelper();
        coffeeService.findAllByIds(Arrays.asList(1,2,3));
    }

    public static void main(String[] args) {
        SpringApplication.run(SpringBucksSpApplication.class, args);
    }

}
